/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package br.com.pharmproject.utils;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

/**
 *
 * @author rodrigo
 */
public class ConverterMD5 {

   
    
    
     public static String getMD5(String str) throws NoSuchAlgorithmException{
        

        MessageDigest parseMD5 = MessageDigest.getInstance("MD5");

        parseMD5.update(str.getBytes());

        byte byteData[] = parseMD5.digest();
        StringBuffer sb = new StringBuffer();

        for (int i = 0; i < byteData.length; i++){
            sb.append(Integer.toString(
                    (byteData[i] & 0xff) + 0x100, 16).substring(1));
        }
        
    
        return sb.toString();
    }
}
